package com.qf.weektest.util;

import cn.hutool.jwt.JWT;
import com.qf.weektest.vo.Constants;

import java.io.UnsupportedEncodingException;
import java.util.Date;

public class JWTUtil {

    public static String getToken(String telephone) throws UnsupportedEncodingException {

        String token = JWT.create().setPayload("telephone", telephone)
                .setExpiresAt(new Date(System.currentTimeMillis() + 1000 * 60 ))
                .setKey(Constants.SECRET.getBytes("utf-8"))
                .sign();

        return token;
    }
}
